﻿@using CMSMVC4.MultiResource
@using (Html.BeginForm("Index", "Menu", FormMethod.Post))
{
    <div class="row-fluid">
        <div class="box color_13">
            <div class="title">
                <h4>
                    <span>Sửa Menu Home</span></h4>
            </div>
            <div class="content top">
                @ViewBag.mess
                <table id="datatable_example" class="responsive table table-striped table-bordered"
                    style="width: 100%">
                    <thead>
                        <tr>
                            <th>
                                Menu
                            </th>
                            <th>
                                Icon (autoX30)
                            </th>
                            <th>
                                Image (233X140)
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>
                                Giới Thiệu
                            </td>
                            <td>
                                <input name="gtid" type="hidden" value="@ViewBag.GioiThieu.Id"/>
                                <input class="span12" id="gticont" name="gticon" type="text" value="@ViewBag.GioiThieu.Icon" />
                                <input class="btn" id="gticonb" type="button" value="Chọn icon" />
                            </td>
                            <td>
                                <input class="span12" id="gtimaget" name="gtimage" type="text" value="@ViewBag.GioiThieu.Image" />
                                <input class="btn" id="gtimageb" type="button" value="Chọn ảnh" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Thiết Bị
                            </td>
                            <td>
                                <input name="tbid" type="hidden" value="@ViewBag.ThietBi.Id"/>
                                <input class="span12" id="tbicont" name="tbicon" type="text" value="@ViewBag.ThietBi.Icon" />
                                <input class="btn" id="tbiconb" type="button" value="Chọn icon" />
                            </td>
                            <td>
                                <input class="span12" id="tbimaget" name="tbimage" type="text" value="@ViewBag.ThietBi.Image" />
                                <input class="btn" id="tbimageb" type="button" value="chọn ảnh" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Dịch Vụ
                            </td>
                            <td>
                                <input name="dvid" type="hidden" value="@ViewBag.DichVu.Id"/>
                                <input class="span12" id="dvicont" name="dvicon" type="text" value="@ViewBag.DichVu.Icon" />
                                <input class="btn" id="dviconb" type="button" value="Chọn icon" />
                            </td>
                            <td>
                                <input class="span12" id="dvimaget" name="dvimage" type="text" value="@ViewBag.DichVu.Image" />
                                <input class="btn" id="dvimageb" type="button" value="Chọn ảnh" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Đối Tác
                            </td>
                            <td>
                                <input name="dtid" type="hidden" value="@ViewBag.DoiTac.Id"/>
                                <input class="span12" id="dticont" name="dticon" type="text" value="@ViewBag.DoiTac.Icon" />
                                <input class="btn" id="dticonb" type="button" value="Chọn icon" />
                            </td>
                            <td>
                                <input class="span12" id="dtimaget" name="dtimage" type="text" value="@ViewBag.DoiTac.Image" />
                                <input class="btn" id="dtimageb" type="button" value="Chọn ảnh" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <input class="btn btn-large btn-success" type="submit" value="Save Changes" />
}
<script type="text/javascript">
    $(function () {
        $('#gticonb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#gticont").val(fileUrl);
            };
            finder.popup();
        });
        $('#gtimageb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#gtimaget").val(fileUrl);
            };
            finder.popup();
        });
        $('#tbiconb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#tbicont").val(fileUrl);
            };
            finder.popup();
        });
        $('#tbimageb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#tbimaget").val(fileUrl);
            };
            finder.popup();
        });
        $('#dviconb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#dvicont").val(fileUrl);
            };
            finder.popup();
        });
        $('#dvimageb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#dvimaget").val(fileUrl);
            };
            finder.popup();
        });
        $('#dticonb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#dticont").val(fileUrl);
            };
            finder.popup();
        });
        $('#dtimageb').click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#dtimaget").val(fileUrl);
            };
            finder.popup();
        });
    });
</script>
